<template>
  <div class="risk">
    <!-- <div class="add" @click="add">新增</div> -->
    <eagle-page-list
      :controller="controller"
      :queryParams="queryParams"
      @bindData="bindData"
      :conditions="conditions"
      ref="eaglePageList"
    >
     <template #list>
       <eagle-cell
        style="margin-top: 10px"
        class="br-8"
        v-for="(item, index) in list"
        :key="index"
       >
         <eagle-tag
          v-if="item.Status === 10 && !item.IsExpire"
          class="info_tag"
          color="#1989fa"
          >进行中</eagle-tag
        >
        <eagle-tag
          v-if="item.Status === 10 && item.IsExpire"
          class="info_tag"
          type="danger"
          >已过期</eagle-tag
        >
        <div class="warn_item">
          <div @click="goDetail(item)">
            <eagle-row>
              <eagle-col span="24">
                {{ index + 1 }}、{{ item.CheckTaskName }}</eagle-col
              >
            </eagle-row>
            <eagle-row gutter="20" class="dep_sort">
              <eagle-col span="12">
                <img
                  src="@/assets/Images/AppIcon/icon_list_type.png"
                  alt=""
                />{{ item.CheckTypeName }}</eagle-col
              >
              <eagle-col span="12">
                <img
                  src="@/assets/Images/AppIcon/icon_list_danger.png"
                  alt=""
                />隐患/检查：{{ item.HiddenDangerCnt }}/{{
                  item.CheckCnt
                }}</eagle-col
              >
            </eagle-row>

            <eagle-row gutter="20" class="dep_sort">
              <eagle-col span="12">
                <img
                  src="@/assets/Images/AppIcon/icon_list_user.png"
                  alt=""
                />{{ item.CreateChnName }}</eagle-col
              >
            </eagle-row>

            <eagle-row gutter="20" class="dep_sort">
              <eagle-col span="24">
                <img
                  src="@/assets/Images/AppIcon/icon_list_date.png"
                  alt=""
                />{{ item.StartDate | formatDate }}至{{ item.EndDate | formatDate }}</eagle-col
              >
            </eagle-row>
          </div>
        </div>
       </eagle-cell>
     </template>
    </eagle-page-list>
  </div>
</template>

<script>
import { getDateTime} from "@/utils/getDate";
export default {
  data() {
    return {
      list: [],
      conditions: {},
      controller: "/DangerCheckTask",
      queryParams: {
        dataType: "RiskPointTask",
        checkAreaType: "",
        checkAreaCode: "",
        statusType: "",
      },
    };
  },
  created() {
    if (this.$route.query.areaType) {
      this.queryParams.checkAreaType = this.$route.query.areaType;
    }
    if (this.$route.query.areaCode) {
      this.queryParams.checkAreaCode = this.$route.query.areaCode;
    }
  },
  filters: {
    formatDate: function(value, args) {
      return getDateTime(value);
    },
  },
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    goDetail(item) {
      this.$router.push({
        path: "/Danger/DangerCheckTaskEdit",
        query: { id: item.ID },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.risk {
  background-color: #e8f1f8;
  .info_search {
    padding: 10px;
    border-radius: 5px !important;
    .van-field__control {
      background-color: #ffffff !important;
    }
  }
}
.all_dep {
  background-color: #ffffff;
}
.warn_item {
  margin: 10px;
  /*margin-bottom: 10px;*/
  // padding: 10px 0 10px 10px;
  border-radius: 5px;
  position: relative;
}
.warn_header {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 10px;
  .warn_tag {
    position: absolute;
    right: 0;
    top: 0;
    border-radius: 26.64rem 0 0 26.64rem;
  }
}
.dep_sort {
  // display: flex;
  // flex-wrap: wrap;
  // margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
}
.dep_btm {
  display: flex;
  justify-content: flex-end;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.choose_btm {
  display: flex;
  width: 100%;
  justify-content: space-between;
  position: fixed;
  bottom: 0;
  background-color: #fff;
  .choose_cancel {
    padding: 0 10px;
    display: flex;
    align-items: center;
    float: left;
  }
  .choose_confirm {
    float: right;
    border-radius: 0;
  }
}
</style>
